execution/stagedsync: use versionmap instead of BlockStateCache in block-finalize (P2) - #23149
Draft
sudeepdino008 wants to merge 2 commits into
Draft
Conversation
sudeepdino008
force-pushed
the
sudeepdino008/bsc-finalize-versionmap
branch
from
August 11, 2026 05:03
c27675b to
561dd02
Compare
sudeepdino008
changed the base branch from
sudeepdino008/bsc-rm-calcfees-normalize-reader
to
sudeepdino008/bsc-rm-worker-committed-tier
August 11, 2026 05:03
… map (#23140) The block-complete engine.Finalize IBS (withdrawals, EIP-7002/7251 system calls) read prior-tx in-block state through the BlockStateCache write buffer via an empty local version map. Give it be.versionMap and a pre-block-only reader: at block end every cell is Done and versionedReadCore applies self-destruct/revival, so the version map is a strict superset of the old blockCache read for this reader — and fixes the block 24839300 trie-root race (a tip-adjacent historic block's withdrawal read the pre-block balance and stomped a prior tx's update). TestFinalizeIBSSeesVersionMapWrite pins it. The per-tx calcFees/finalize readers keep the block write buffer. Dropping it there (folded-out #23147) regressed the 2016 EIP-161 empty-account sweep window: CachedReaderV3.ReadAccountData populates the buffer's committed tier as a read side-effect that feeds the deferred-commitment touchmap, so a nil base corrupted the commitment structure and produced a wrong trie root some blocks later (block 2676607 on a from-0 mainnet re-execution).
sudeepdino008
force-pushed
the
sudeepdino008/bsc-rm-worker-committed-tier
branch
from
August 12, 2026 06:13
3960cee to
d07d799
Compare
sudeepdino008
force-pushed
the
sudeepdino008/bsc-finalize-versionmap
branch
from
August 12, 2026 06:13
5dac65a to
53e4734
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 2 of removing/reducing dependence on
BlockStateCache(#23140). Stacked on #23146.Summary
The block-complete finalize IBS (
engine.Finalize: withdrawals, EIP-7002/7251 syscalls) read the in-block state through theBlockStateCachewrite buffer (it got an emptyversionMap, so all reads fell through to the blockCache).This PR gives it a populated versionMap + a pre-block-only reader instead.
be.versionMapcell is Done andversionedReadCoreapplies self-destruct/revival — so it's a strict superset of the old blockCache read. MirrorsfinalizeSystemTx, which already reads viabe.versionMap.